//Komissarov Denis
package MAINWIN;

import javax.swing.Box;
import javax.swing.JDialog;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Dimension;

import javax.swing.JButton;
import javax.swing.border.EmptyBorder;

import java.awt.GridLayout;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JLabel;
import javax.swing.ImageIcon;

import Resources.CEnvironment;
import javax.swing.SwingConstants;
import java.awt.FlowLayout;

public class CAboutForm extends JDialog {

	private static final long serialVersionUID = 4258217493273459720L;

	CAboutForm(String title) {
		setSize(305, 329);
		setLocationRelativeTo(null);
		setResizable(isMinimumSizeSet());
		setTitle(title);
		setModal(true);

		JPanel panelOK = new JPanel();
		getContentPane().add(panelOK, BorderLayout.SOUTH);
		panelOK.setLayout(new GridLayout(0, 3));
		panelOK.setBorder(new EmptyBorder(10, 10, 10, 10));
		panelOK.add(Box.createRigidArea(new Dimension(0, 0)));
		panelOK.add(Box.createRigidArea(new Dimension(0, 0)));

		JButton btnOK = new JButton("OK");
		btnOK.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				setVisible(false);
			}
		});
		panelOK.add(btnOK);

		JPanel panel = new JPanel();
		getContentPane().add(panel, BorderLayout.NORTH);
		panel.setLayout(new GridLayout(0, 3));
		panel.setBorder(new EmptyBorder(20, 20, 0, 0));
		JLabel lblNewLabel = new JLabel(new ImageIcon(
				CAboutForm.class.getResource(CEnvironment.AboutLogo)));
		panel.add(lblNewLabel);
		panel.add(Box.createRigidArea(new Dimension(0, 0)));
		panel.add(Box.createRigidArea(new Dimension(0, 0)));

		JPanel panel_1 = new JPanel();
		FlowLayout flowLayout = (FlowLayout) panel_1.getLayout();
		flowLayout.setHgap(40);
		getContentPane().add(panel_1, BorderLayout.WEST);

		JLabel lblText = new JLabel(CEnvironment.AboutText);
		lblText.setHorizontalAlignment(SwingConstants.LEFT);
		lblText.setVerticalAlignment(SwingConstants.TOP);
		getContentPane().add(lblText, BorderLayout.CENTER);

	}

}